import { Button } from 'antd'
import { useState, useEffect } from 'react'

function Index() {
    const [item, setitem] = useState(() => {
        return localStorage.getItem('item') || 'bai'
    })
    useEffect(() => {
        document.documentElement.setAttribute('data--item', item)
        localStorage.setItem('item', item)
    }, [item])
    return (
        <div>
            <Button onClick={() => { setitem(item === 'bai' ? 'ye' : 'bai') }}>{item === 'bai' ? 'ye' : 'bai'}</Button>
        </div>
    )
}

export default Index
